package 第四天

import kotlin.reflect.KProperty


fun main() {
    var s = BigSon()
    s.压岁钱 = 100
    println(s.压岁钱)
}

class BigSon {
    var 压岁钱: Int by Father()
}

class Father {
    var 儿子的压岁钱: Int = 10
    operator fun getValue(bigSon: BigSon, property: KProperty<*>): Int {
        return 儿子的压岁钱 - 45
    }

    operator fun setValue(bigSon: BigSon, property: KProperty<*>, i: Int) {
        this.儿子的压岁钱 = i
    }


}